UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XhtE1MZGSTV8Oy13kXxV3TNw10+GCg2E2f4tNqIecOk=' 
WHERE 
  key_id = '77033c18a2cc66ac9a8cb14aa77b9952559f5e0cd5cea30de57c24db68b41a52' 
  AND (
    token = 'XhtE1MZGSTV8Oy13kXxV3TNw10+GCg2E2f4tNqIecOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058