UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ATfHpZqbMLXCS/3GMfGT9pVAid1ze/Udnlq83AN9mjY='
WHERE
key_id = 'ad18e4d650d15efe730eacd780e403aab4207a0b6b928562af250e6f0c5d4747'
AND (
token = 'ATfHpZqbMLXCS/3GMfGT9pVAid1ze/Udnlq83AN9mjY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)