UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K8LV+zPiV8IahvRDeDjblWIuH5byN2qB5pEgVGk51f0='
WHERE
key_id = 'f5e31807133a14b4bd6510f4383e04f0fdcb60a8feeb44a45b1820cca1009cec'
AND (
token = 'K8LV+zPiV8IahvRDeDjblWIuH5byN2qB5pEgVGk51f0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)