UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXK/1N1YdnbZQMPxwDFDBHjblg0jFBhsSKrHZqbopWs=' 
WHERE 
  key_id = '387aef775f0180d561e60cff55959287537c52be92fdafafed6ed204ac7b13e1' 
  AND (
    token = 'yXK/1N1YdnbZQMPxwDFDBHjblg0jFBhsSKrHZqbopWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027