UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7wUIi85OUOoBw8Cb+xBDvzY4czHjxgIO+TL34Sx1m+Q='
WHERE
key_id = '331ab585d44d37926a73268456de01e684ecf80fcd4bab0aaccc6b65e0b7a9cf'
AND (
token = '7wUIi85OUOoBw8Cb+xBDvzY4czHjxgIO+TL34Sx1m+Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)