UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ScPwlGRdRDZGxXIPFPMeQEEnmcXwKD+fojHRtdu0NuI=' 
WHERE 
  key_id = 'd967980b3fd11868c7f8bf42e5c3e967a1d4805554afe3ab1cfba5687c0fa238' 
  AND (
    token = 'ScPwlGRdRDZGxXIPFPMeQEEnmcXwKD+fojHRtdu0NuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040