UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQt0Spuz7zaqrV5H5wIUGsewagG20Wq6Ic8Jd2BVWkk='
WHERE
key_id = '01ef393a1eda9ae9fe86be0bb3b91d2fe23c054736f4b5831b250ca1fc292505'
AND (
token = 'tQt0Spuz7zaqrV5H5wIUGsewagG20Wq6Ic8Jd2BVWkk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)