UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ImjTWFcmzeiah07hArvg1/MTs1X3dgOs7RcSobwBRpo='
WHERE
key_id = '40866569c6ad5d27e99c1b7b8dc6f92e7383b8437643a43a4c2681986667eb81'
AND (
token = 'ImjTWFcmzeiah07hArvg1/MTs1X3dgOs7RcSobwBRpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)