UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0cND03FIy48EtJYzLDMPCg3rzQqY60OQ9Rc7wsO5AAg='
WHERE
key_id = 'a89a1e059035610417b37a9ef7eac0dbdf7e7dd3e30b51986b0a48284b83ab9e'
AND (
token = '0cND03FIy48EtJYzLDMPCg3rzQqY60OQ9Rc7wsO5AAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)