UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1yQwOTHXhlUeAl7V5l5TNwSmIx58FeTOFpQj/1X+urM='
WHERE
key_id = '3f29b67dfefb9d406001fbea74eae30618e125cb4f288802f7f25112bfb57aaf'
AND (
token = '1yQwOTHXhlUeAl7V5l5TNwSmIx58FeTOFpQj/1X+urM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)