UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bq5McGkQxUn4yBcQOoGnmDuJbyDNlAJ54zasdOHanK0='
WHERE
key_id = '831ac0202c614858b1f1f73f31c1df603eadf52795b68695636e5cb2b846d079'
AND (
token = 'Bq5McGkQxUn4yBcQOoGnmDuJbyDNlAJ54zasdOHanK0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)