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