UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K8ZGec+LwN80iQrfcBBE+M76cuiIEztCcXtpWZV6uZM='
WHERE
key_id = '1fbc52223c944d0bc2976fac6ae15b1dc8339e2132849e4fd5944ed1c1cfee3f'
AND (
token = 'K8ZGec+LwN80iQrfcBBE+M76cuiIEztCcXtpWZV6uZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)