UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZtIlj8XLl7g7qzfQFy1hpGV4Mnr1jKYYOe7gs8z+dZk='
WHERE
key_id = '54cd71ec9f5c1af2068e3176a0e6b3b9c6308766555137e75b3a345466bd3fb2'
AND (
token = 'ZtIlj8XLl7g7qzfQFy1hpGV4Mnr1jKYYOe7gs8z+dZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)