UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M8y32IPFx76o9MAhktOSwWyOZ5fmk3pOQNwIShhBYd0='
WHERE
key_id = 'ffcd807b38ffad1cf224658736e2b6c4f1b7b095b2247c18eb58182b110eb08f'
AND (
token = 'M8y32IPFx76o9MAhktOSwWyOZ5fmk3pOQNwIShhBYd0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)