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