UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n332rb/FGVKcKnEQjz0Tj25yFkhqV0rEs9uUVv2j16w=' 
WHERE 
  key_id = 'b18b1a656d2a46d9f6469a961c14e30cc32e60c58422cb8cc05873a59c38170c' 
  AND (
    token = 'n332rb/FGVKcKnEQjz0Tj25yFkhqV0rEs9uUVv2j16w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031