UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ph4ooZXkGhSqfIjGPkV20LUKWka8T8pgFPWlhTQXv70='
WHERE
key_id = '06f8e0b21308429369225850dc2491f99a4c088417f6617cd97e0662b822f187'
AND (
token = 'Ph4ooZXkGhSqfIjGPkV20LUKWka8T8pgFPWlhTQXv70='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)