UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5pUZWJnuii0LLEEPzwaUv8zymjC2fs9Z0fH18gMBwCg='
WHERE
key_id = 'e894dc7c29213b62a5a672526974bb671111f92f7575b773e68d254c47e5d7f4'
AND (
token = '5pUZWJnuii0LLEEPzwaUv8zymjC2fs9Z0fH18gMBwCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)