UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EZmY0mxAWItuY39Q3gmFSbJ2Bs9aGUUzpZ2I9Amwb48='
WHERE
key_id = '55be15cc44fd0c19a1687457c472a7039a39cc37828ec111081196ccb1d872c3'
AND (
token = 'EZmY0mxAWItuY39Q3gmFSbJ2Bs9aGUUzpZ2I9Amwb48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)