UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YEjTlGV0RW/sOabM7eyAmwvdw2VHpYfu6wh94u2DwQE='
WHERE
key_id = '0ae7ea7facdf98f9638219c76eb01cae76e79bab22e821132c2741ef184a3f97'
AND (
token = 'YEjTlGV0RW/sOabM7eyAmwvdw2VHpYfu6wh94u2DwQE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)