UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '99jN2EJu+e5u3ODyImt3SJGkg8xNOLhwlg4cyyG8bR8=' 
WHERE 
  key_id = 'ea5816237bbf984d3aa4206578bdd87efc828e5c92970939055c28a02c8184df' 
  AND (
    token = '99jN2EJu+e5u3ODyImt3SJGkg8xNOLhwlg4cyyG8bR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070