UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rdA6mrUSaJuBtkB+vesEs7l+vTJlGS+LijO4XGaxRM4='
WHERE
key_id = 'b92fe09709fc3e88db06e6861bbce7322d768b9247a4c8f5c162cee87a732050'
AND (
token = 'rdA6mrUSaJuBtkB+vesEs7l+vTJlGS+LijO4XGaxRM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)