UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8dSb4lGkzPAkEiR8E0eGFqFYJXSYsOXpVvbJkeYH9A='
WHERE
key_id = '4cd48d4e25e689779a468154da5d4be683cc81a863848b7553ee16fbfada6382'
AND (
token = 'N8dSb4lGkzPAkEiR8E0eGFqFYJXSYsOXpVvbJkeYH9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)