UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tz4OR+S+NtenAnYaAQ961j4FSSD+3bVsd38caDKcmXc='
WHERE
key_id = '40f1ca5f86724e28684394c77384193883051e30537a9e5c160414eaa4ce32f3'
AND (
token = 'Tz4OR+S+NtenAnYaAQ961j4FSSD+3bVsd38caDKcmXc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)