UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hbZEHTZSKQ6eXfuseZhbNxJJYpz/cW/298iCY4EKisc=' 
WHERE 
  key_id = 'b709600f7b9e3a4389bdac7cc04841769737a41e21f680bfa11af6404f98fac9' 
  AND (
    token = 'hbZEHTZSKQ6eXfuseZhbNxJJYpz/cW/298iCY4EKisc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033