UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GRERRTI3S+LR2VPKkpBqx7NjZ3l+z64TwHis72WAgE8='
WHERE
key_id = 'd89e4efd7985c215dcbcda70515e5eb59a4f05d82afcaed4c5fefeb9d196cc68'
AND (
token = 'GRERRTI3S+LR2VPKkpBqx7NjZ3l+z64TwHis72WAgE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)