UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'awRs9gRmq1iUy7PoNHIara+ikksz264r+b3k0QciK90='
WHERE
key_id = 'f13890379d94a75eee9209a99798cbd63e66069af0240d947948340bf33f5c9a'
AND (
token = 'awRs9gRmq1iUy7PoNHIara+ikksz264r+b3k0QciK90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)