UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+q9KPJX0HZrt38r8TIiJq+mcJt8gayptF9DlhIuEjYU=' 
WHERE 
  key_id = 'c04123d43a65d2d5356497fff1492548c1bd939159dc3733d161e18494cdb956' 
  AND (
    token = '+q9KPJX0HZrt38r8TIiJq+mcJt8gayptF9DlhIuEjYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027