UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JL+pbBHIwjSnlueH18Bd+YtJcK9av78YiYNzyTBnsdU=' 
WHERE 
  key_id = '090295ff4b9072aac50e843047c4e7580851cc852c9ef67e833ad97cc1166492' 
  AND (
    token = 'JL+pbBHIwjSnlueH18Bd+YtJcK9av78YiYNzyTBnsdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039