UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LOzKBy1FrtNhbzm07BH+Qhym9BdCOgnBYtg5epfn6r0=' 
WHERE 
  key_id = 'bc0df5cb2cc95e7460a3b39b454045a350c658028b191f35cccbe61f93b9efff' 
  AND (
    token = 'LOzKBy1FrtNhbzm07BH+Qhym9BdCOgnBYtg5epfn6r0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037