UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3aeQRGhbKAVhYV3BUdG+lYK/S7Oaz9qSto4cW5e4jfQ='
WHERE
key_id = 'cd4585e431d046b0b28e11fe10a0bc389f523e81dc7104ae8e8f457e8db1acf4'
AND (
token = '3aeQRGhbKAVhYV3BUdG+lYK/S7Oaz9qSto4cW5e4jfQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)