UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rj3o6jhmdJ3b1hwUzDsXQjhWoQSYxDqv1ARUXs0Gw0A=' 
WHERE 
  key_id = '6c3019ed4a6a4a84aa18be71914518aa65ec871f9315246bea2b36052015ccf3' 
  AND (
    token = 'Rj3o6jhmdJ3b1hwUzDsXQjhWoQSYxDqv1ARUXs0Gw0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034