UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b0JEc0kxjUu05U2pMjo2OmYyovQnZ+FEkFEMnBs4oF8='
WHERE
key_id = '6e9ee735c795c4d1d9e0b7f1ad844dca5980b1df52f1324ebda4f6cd023aea7a'
AND (
token = 'b0JEc0kxjUu05U2pMjo2OmYyovQnZ+FEkFEMnBs4oF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)