UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w3sRgW7XYq9dOjCAe3t3x591T3IRn37s8c8vqZqhArY=' 
WHERE 
  key_id = '9dc1b0832c232bb768987c65bac2a21249913f056728bccf8bd3804b8fb960d4' 
  AND (
    token = 'w3sRgW7XYq9dOjCAe3t3x591T3IRn37s8c8vqZqhArY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026