UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'klb3EP4PEcBfMoIWJwqzavYMP3a9U4wHbcRRg/hYIno='
WHERE
key_id = 'a2c58f9ba7250044fce630b8049dbfbdd19b0bb69935a289e7bdc6b3b71b9ea0'
AND (
token = 'klb3EP4PEcBfMoIWJwqzavYMP3a9U4wHbcRRg/hYIno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)