UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm/qiwur/axxa12+mG9KPsozRsrT+Q1sg3Y6dryG2SDU='
WHERE
key_id = 'cfb5d95c3dceca47ac537e247b853099d087e51e0b8b5b138a77dc5f584d2cba'
AND (
token = 'm/qiwur/axxa12+mG9KPsozRsrT+Q1sg3Y6dryG2SDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)