UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BM23iRWqUVU4ne9k+cvrzYDqxGN8gu8H4XpKJEW3HIQ=' 
WHERE 
  key_id = 'fdf9b14c5a62280514816f505e6790e8586bf597c7a9b2eebfb119b7dc357046' 
  AND (
    token = 'BM23iRWqUVU4ne9k+cvrzYDqxGN8gu8H4XpKJEW3HIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034