UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ks8q+rFLgyWKvPWjxte8SsFLw9WyGRgpUH1CbY9NIOI='
WHERE
key_id = '3e5f79348215901b86227549717d16db233311127346918f0f0d7e26074e1daf'
AND (
token = 'Ks8q+rFLgyWKvPWjxte8SsFLw9WyGRgpUH1CbY9NIOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)