UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mi/fORdp2s+fIQ8nGhk/EWp8LJATIinU2aUomVHKSL0='
WHERE
key_id = 'e7120f4a510ffc0dc4c63239811496527617214a6720a0928d72efd7b3494cab'
AND (
token = 'mi/fORdp2s+fIQ8nGhk/EWp8LJATIinU2aUomVHKSL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)